/*
 * @Author: error: git config user.name & please set dead value or install git
 * @Date: 2022-08-31 10:26:21
 * @LastEditors: error: error: git config user.name & please set dead value or install git && error: git config user.email & please set dead value or install git & please set dead value or install git
 * @LastEditTime: 2023-05-10 10:29:23
 * @FilePath: \stm32g431_AllRings\libraries\HAL_Drivers\my_fdcan_drv.h
 * @Description:
 *
 * Copyright (c) 2022 by error: git config user.name && git config user.email & please set dead value or install git, All Rights Reserved.
 */
#ifndef __MY_FDCAN_DRV_H
#define __MY_FDCAN_DRV_H

#include <rtthread.h>
#include <board.h>
#include "rtdebug.h"

//#define USE_FDCAN_WAYS

extern FDCAN_HandleTypeDef hfdcan1;

extern FDCAN_TxHeaderTypeDef TxHeader1;
extern FDCAN_RxHeaderTypeDef RxHeader1;

struct _fdcan_rxdata
{
    uint8_t id;
    uint8_t dta_length; // 数据长度
#ifdef USE_FDCAN_WAYS	
    uint8_t data[64];
	#else
	uint8_t data[8];
	#endif
};

void HAL_FDCAN_MspInit(FDCAN_HandleTypeDef *hfdcan);
void HAL_FDCAN_MspDeInit(FDCAN_HandleTypeDef *hfdcan);
void fdcan1_filter_config(void);

void FDCAN_Transmit(FDCAN_HandleTypeDef *hfdcan, uint32_t id, uint16_t data_length, uint8_t *fdcandata);
void CANIO_UpdateID(uint8_t _id);

#endif

